package com.wc.AlgoOJ_train.train1.c4.A301;

import java.util.*;

/**
 * @Author congege
 * @Description 第几天
 * http://43.138.190.70:8888/p/A301
 * @Date Created in 2024/1/3-13:39
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] months = new int[]{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        int[] dp = new int[13];
        for (int i = 1; i < months.length; i++) {
            dp[i] = dp[i - 1] + months[i];
        }
        while (sc.hasNextLine()) {
            String s = sc.nextLine();
            String[] ss = s.split("/");
            int year = Integer.parseInt(ss[0]);
            int month = Integer.parseInt(ss[1]);
            int day = Integer.parseInt(ss[2]);
            if (isRun(year) && month >= 3) {
                System.out.println(dp[month - 1] + day + 1);
            } else {
                System.out.println(dp[month - 1] + day);
            }
        }
    }

    public static boolean isRun(int year) {
        return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
    }
}
